#ifndef __FORTHEDREAM_SINGLETON__
#define __FORTHEDREAM_SINGLETON__

#include "commDef.h"
namespace ftd
{
	template<class T>
	class SingleTon
	{
	public:
		SingleTon<T>(){};
		virtual ~SingleTon<T>()
		{
			SAFE_DELETE(instance);
		}

		static T* getInstance()
		{
			if (NULL == instance)
			{
				instance = new T();
			}
			return instance;
		}
		static T* release()
		{
			SAFE_DELETE(instance);
		}
	protected:
		static T* instance;
	};

	template<class T>
	T* SingleTon<T>::instance=NULL;
}
#endif